package request

import "github.com/asaskevich/govalidator"

type MsmRequest struct {
	Phone string `json:"phone"`
	Type  int    `json:"type"`
}

func (m *MsmRequest) Validate() (ok bool) {
	if m.Type != 0 && m.Type != 1 {
		return
	}
	ok = govalidator.StringMatches(m.Phone, `^((\+86)|(86))?(1(([35][0-9])|[8][0-9]|[7][06789]|[4][579]))\d{8}$`)
	return
}
